<template>
  <div id="J_prismPlayer" />
</template>

<script>
import movieApi from '@/api/movieManage'

export default {
  name: 'Video',
  data() {
    return {
      movie: {

      },
      movieList: [{
        name: '你好'
      }, {
        name: '点对对对'
      }]
    }
  },
  mounted() {
    this.getMovieAll()
    this.init()
  },
  created() {
    // this.getMovieAll()
    // console.log(this.movieList)
  },
  methods: {
    init() {
      movieApi.getMovie(1, 1).then(response => {
        this.movie.image = response.data.image
        this.movie.vid = response.data.playId
        this.movie.playauth = response.data.playAuth
        console.log(response)
      })
    },
    getMovieAll() {
      console.log('@')
      console.log(this.movieList)
      movieApi.getMovieAll().then(response => {
        console.log('@@')
        console.log(response.data)
        this.movieList = response.data
        console.log(this.movieList === response.data)
        console.log('@@@')
        console.log(response.data)

        console.log('@@@@')
        console.log(this.movieList)

        new Aliplayer({
          id: 'J_prismPlayer',
          width: '100%',
          height: '500px',
          autoplay: false,
          isLive: false,
          preload: true,
          cover: response.data[0].image, // 图片
          vid: response.data[0].vid, // 必选参数。音视频ID。示例：1e067a2831b641db90d570b6480f****。
          playauth: response.data[0].playauth,
          components: [{
            name: 'PlaylistComponent',
            type: AliPlayerComponent.PlaylistComponent,
            args: [
              response.data
            ]
          }]
        }, function(player) {
          console.log('The player is created.')
        })
      })
    }
  }
}
</script>

<style scoped>

</style>
